/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Topka;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Arrays;

/**
 *
 * @author Asko
 */
public class Client {

    public static void main(String args[]) {
        try {
            int r = 0 , i = 0;
            String buf = "";
            char res[] = new char[1024];
            Socket s = new Socket("localhost", 3456);
            InputStream is = s.getInputStream();
            while ((r = is.read()) != -1) {
                res[i++] = (char)r ;
            }
            
            System.out.println("Result: " + String.valueOf(res));
            
            s.close();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
